﻿using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Yozeev.BankService.Clients;
using Yozeev.BankService.Models;

namespace Yozeev.Controllers.Tests
{
    [Route("api/Test/[Controller]/[Action]")]
    public class BankPayTestController: YozeevControllerBase
    {
        private readonly IPaymentClient _bankClient;

        public BankPayTestController(PaymentClient client)
        {
            _bankClient = client;
        }

        [HttpGet]
        public async Task TestMessage()
        {
            WeichatPayReq req = new WeichatPayReq
            {
                IsBreakAccount = "0",
                SubMerchantID = "ssssss",
                CommodityType = "0599",
                MerchantRemarks = "test",
                MerModelFlag = "1",
                NofityType = "1",
                PaymentLinkType = "2",
                PaymentType = "8",
                ResultNotifyURL = "test",
                Order = new WeichatOrderItem 
                {
                    AccountNo = "test",
                    SplitAccInfoItems = new WeichatOrderItem.SplitAccount { SplitAmount = "1", SplitMerchantID = "3"},
                    BuyIP = "",
                    CurrencyCode = "s",
                    ExpiredDate = "we",
                    LimitPay = "s",
                    OpenID = "w",
                    OrderAmount = "123",
                    OrderDate = "s",
                    OrderDesc = "we",
                    OrderNo = DateTime.Now.ToString(),
                    OrderTime = "ss",
                    orderTimeoutDate = "w",
                    PayTypeID ="1",
                    ReceiverAddress = "s"
                }
            };
            List<WeichatOrderItem> details = new List<WeichatOrderItem>();
            WeichatOrderItem item = new WeichatOrderItem { };
            details.Add(item);
            await _bankClient.WeichatPay(req, details);
        }
    }
}
